<?php
declare (strict_types=1);

namespace app\middleware;

use app\Request;
use Lcobucci\JWT\Parser;


class WeChatApiLogin
{

    public function handle($request, \Closure $next)
    {
        $header = $request->header();
        if (!isset($header['token'])) {
            return json(['code' => 440, 'msg' => 'request must with token']); // token必传
        }
        $token = $header['token'];
        $jwt_result = getUserId($token);

        if ($jwt_result['code'] != 200) {
            return json($jwt_result);
        }


    }
}
